#include "stdafx.h"
#include "RandomStastic.h"

void RandomStastics::Credit( const std::string& sName,bool bSuccess )
{
	Counter & rCounter=m_mCounters[sName];
	rCounter.m_sName=sName;
	if(bSuccess)
	{
		rCounter.m_iSuccess++;
	}
	else
	{
		rCounter.m_iFailed++;
	}
}

void RandomStastics::EnumCounters( std::vector< const Counter*>& vCounters ) const
{
	vCounters.clear();
	std::map<std::string,Counter>::const_iterator it=m_mCounters.begin();
	for(;it!=m_mCounters.end();it++)
	{
		vCounters.push_back(&(it->second));
	}
}